solve quadratic equations by grouping method